<?php

namespace app\common\model;

use think\Model;


class Hospital extends Model
{

    

    

    // 表名
    protected $name = 'hospital';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];









    public function getStatusList()
    {
        return ['0' => __('Status 0'), '1' => __('Status 1')];
    }

    public function user()
    {
        return $this->belongsTo('User', 'user_ids', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function getEnzdAttr($value, $data)
    {
        $enzdArr =User::where("id", "in", $data["user_ids"]) ->column('nickname');
        return implode(",", $enzdArr);
    }
}
